package com.atguigu.eduservice.toming;

/**
 * @ClassName ChineseNameDesensitization
 * @Description: TODO
 * @Author: NeySun
 * @Create: 2022-10-31 14:26
 * @Version 1.0
 **/
public class ChineseNameDesensitization extends AbstractDesensitization {

    @Override
    public String serialize(String value) {
        String serializeValue = "";
        if(value.length() < 3){
            serializeValue = value.replaceAll(".*(?=[\\u4e00-\\u9fa5])","*");
        }else{
            serializeValue = value.replaceAll("(?<=[\\u4e00-\\u9fa5]).*(?=[\\u4e00-\\u9fa5])","*");
        }
        return serializeValue;
    }

}
